package com.pengtu.service.project.labs;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.pengtu.dao.Page;
import com.pengtu.dao.QueryFilter;
import com.pengtu.dao.project.labs.LabsEquipmentDao;
import com.pengtu.entity.project.labs.LabsEquipment;

@Service
@Transactional
public class LabsEquipmentManager {
	@Autowired
	private LabsEquipmentDao labsEquipmentDao;

	// LabsEquipment Manager //
	@Transactional(readOnly = true)
	public LabsEquipment getLabsEquipment(String id) {
		return labsEquipmentDao.get(id);
	}

	@Transactional(readOnly = true)
	public List<LabsEquipment> getAllLabsEquipment() {
		return labsEquipmentDao.getAll();
	}
	
	public void saveLabsEquipment(LabsEquipment labsEquipment) {
		labsEquipmentDao.save(labsEquipment);
	}

	public void deleteLabsEquipment(String id) {
		labsEquipmentDao.delete(id);
	}

	public Page<LabsEquipment> findPageLabsequipment(Page<LabsEquipment> page,
			QueryFilter queryfilter) {
		return labsEquipmentDao.findPage(page, queryfilter);
	}

	@Transactional(readOnly = true)
	public boolean isCodeUnique(String code, String oldCode) {
		return labsEquipmentDao.isPropertyUnique("code", code,oldCode);
		}
}

